<template>
  <div class="comment">
    <div class="count" v-if="comment.length">
      <span>{{comment.length}} 评论</span>
    </div>
    <div class="count" v-else>
      <span>还没有评论哦~</span>
    </div>
    <div class="pinglun" v-if="comment">
      <div class="item" v-for="(i, index) in comment" :key="index">
        <img :src="i.userDetail.avatar_small" alt="" />
        <div class="cont">
          <div class="top">
            <span>{{ i.userDetail.nickname }}</span>
            <i class="iconfont icon-androidgengduo"></i>
          </div>
          <div class="mid">
            <span>{{ i.contentText }}</span>
            <span class="refer" v-if="i.parent"><span class="user">{{i.parent.userDetail.nickname}}</span>:{{i.parent.contentText}}</span>
          </div>
          <div class="bot">
            <span>{{ i.addtime||(i.createTimeUnix/1000) | publishtime }}</span>
            <div class="right" v-if="i.createTimeUnix">
              {{ i.likeCount}}
              <span><i class="iconfont icon-31dianzan"></i>
              </span>
            </div>
            <div class="right" v-else>
              <span><i class="iconfont icon-pinglun1"></i></span>
              <span><i class="iconfont icon-31dianzan"></i>
              {{i.userInfo.count.count_liked}}
              </span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="foot">
      <input type="text" placeholder="我有话要说">
      <span><i class="iconfont icon-31dianzan"></i></span>
    </div>
  </div>
</template>

<script>
export default {
    props:{
      comment:Array
    }
};
</script>

<style lang="less" scoped>
.comment{
  padding: 15px 0;
  background-color: #fff;
  margin-top: 5px;
  margin-bottom: 50px;
  .count{
    font-size: 14px;
    font-weight: 600;
    margin-left: 15px;
  }
  .pinglun {
    width: 100%;
    padding: 0px 15px;
    .item {
      display: flex;
      min-height: 80px;
      img {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        margin-right: 10px;
        margin-top: 10px;
      }
      .cont {
        flex: 1;
        padding: 10px 0;
        border-bottom: 1px solid #f7f7f7;
        .top {
          font-size: 13px;
          color: #555;
          display: flex;
          justify-content: space-between;
          font-weight: 600;
          span {
            text-align: left;
          }
          i {
            color: #888;
          }
        }
        .mid {
          font-size: 14px;
          color: #000;
          margin-top: 5px;
          margin-bottom: 10px;
          display: flex;
          flex-direction: column;
          .refer{
            width: 95%;
            padding: 10px;
            display: inline-block;
            margin-top: 5px;
            background-color: #efefef;
            color: #666;
            .user{
              font-weight: 600;
            }
          }
        }
        .bot {
          display: flex;
          justify-content: space-between;
          font-size: 12px;
          color: #aaa;
          span {
            &:nth-of-type(2) {
              margin: 10px;
            }
          }
          i {
            font-size: 14px;
            color: #aaa;
          }
        }
      }
    }
  }
  .foot{
    width: 100vw;
    height: 40px;
    position: fixed;
    display: flex;
    bottom: 0;
    left: 0;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #666;
    padding: 0 10px;
    background-color: #fff;
    input{
      flex: 1;
      border: none;
      outline: none;
      border-radius: 5px;
      height: 28px;
      margin-right: 15px;
      background-color: #eaeaea;
      padding: 0 10px;
      &::-webkit-input-placeholder{
        font-size: 14px;
        color: #aaa;
      }
    }
    span{
      position: relative;
      i{
        font-size: 20px;
        font-weight: 600;
        margin-right: 5px;
      }
      &::after{
        content: "1";
        font-size: 12px;
        font-weight: 600;
        position: absolute;
        top: -5px;
        right: -2px;
      }
    }
  }
}
</style>